package com.tuanzi.loan.web.bean.family;

import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.web.configuration.JSFListingBean;

import com.tuanzi.loan.vo.request.family.PayRecordHourStatisticSearchRequest;
import com.tuanzi.loan.vo.response.family.PayRecordHourStatisticSearchResponse;
import com.tuanzi.loan.web.lazy.family.PayRecordHourStatisticDataModel;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import java.util.HashMap;

/**
 * 征信入口分时统计
 * @author JinRuiyang 2017/12/22 11:16:38
 */
@Debug
@Data
@Component
@ViewScoped
@EqualsAndHashCode(callSuper = true)
public class PayRecordHourStatisticBean extends JSFListingBean<PayRecordHourStatisticSearchRequest, PayRecordHourStatisticSearchResponse> {

    private HashMap<String, Integer> orderStatus = new HashMap<>();

    @PostConstruct
    private void init() {
        orderStatus.put("待支付",0);
        orderStatus.put("已支付",1);
        orderStatus.put("已完成",2);
        orderStatus.put("退款中",3);
        orderStatus.put("已退款",4);

        initLazyDataModel();
    }

    public void onReset() {
        initLazyDataModel();
    }

    public void onRefresh(){
        lazyDataModel = new PayRecordHourStatisticDataModel($);
        addSuccessfullyMessage();
    }

    private void initLazyDataModel() {
        $ = new PayRecordHourStatisticSearchRequest();
        $.setPayState(-1);
        lazyDataModel = new PayRecordHourStatisticDataModel($);
    }
}